// packageA/mycomponent/goodsComponent/plugin/goodSwipe/goodSwipe.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    goodsInfo: {
      type: null
    },
    broadcast_data: {
      type: null
    },
    is_goodsType: {
      type: null
    }
  },
  lifetimes:{
    attached:function(){
      this.myVideo = wx.createVideoContext('myVideo')
    }
  },
  observers: {
    // "broadcast_data,is_goodsType": function (_data,type) {
    //   console.log(_data,type, "broad11111111111");
    // },
  },
  /**
   * 组件的初始数据
   */
  data: {
    autoplay:2500
  },

  /**
   * 组件的方法列表
   */
  methods: {
    previewImg(e){
      let ind;
      ind = e.currentTarget.dataset.key;
      wx.previewImage({
        current: ind?this.data.goodsInfo.thumb_url[ind]:this.data.goodsInfo.thumb_url, // 当前显示图片的http链接
        urls: this.data.goodsInfo.thumb_url // 需要预览的图片http链接列表
      });
    },
    //视频结束
    ended(){
      this.setData({autoplay:2500})
    },
    play(){
      let autoplay = this.data.autoplay ? false : 2500
      this.setData({autoplay})
    }
  }
});